<?php
/** 首页 店铺提醒 异步获取数据
 * Created by PhpStorm.
 * User: KaZeline
 * Date: 15-11-18
 * Time: 下午2:27
 */
use \PFT\Db;
include_once '/var/www/html/new/d/module/common/Db.class.php';
$dbConf = include_once '/var/www/html/new/d/module/common/db.conf.php';// 远端服务器配置信息
require_once("/var/www/html/new/d/common/func.inc.php");//checkData
Db::Conf($dbConf['remote_1']);
$con_1 = &Db::connect('1');
//
//$_POST = array(
//    'begintime' => '2015-11-01',
//    'endtime' => '2015-11-17',
//    'fid'   => 4
//);
$query[] = checkData(substr($_POST['begintime'],0,10))? substr($_POST['begintime'],0,10): date('Y-m-d',$_SERVER['REQUEST_TIME']-86400);
$query[] = checkData(substr($_POST['endtime'],0,10))  ? substr($_POST['endtime'],0,10)  : date('Y-m-d',$_SERVER['REQUEST_TIME']-86400);
$query[] = $_POST['fid'];
$query[] = $_POST['fid'];

$sql = "select sum(torder),sum(tnum),sum(money) from pft_order_statistics where ddate>=? and ddate<=? and aid=? and mid!=?";
$stmt = $con_1->prepare($sql);
$stmt->execute($query);
$row = $stmt->fetch(\PDO::FETCH_ASSOC);
$return[] = (int)$row['sum(torder)'];
$return[] = (int)$row['sum(tnum)'];
$return[] = $row['sum(money)']/100;
echo json_encode($return);


Db::Close('1');